file = open('file1.txt',mode='r+',encoding='utf8')

# file.seek(5,0)  #相对于开头偏移五个字节
# file.seek(0,2)  #光标在最后时，offset不能往前偏移
file.seek(5,1)    #offset只能是非负值
text = file.read(5)
print(text)

def seek1():
    file = open('file1.txt', mode='r+', encoding='utf8')

    # file.seek(5,0)  #相对于开头偏移五个字节
    # file.seek(0,2)  #光标在最后时，offset不能往前偏移
    file.seek(5, 1)  # offset只能是非负值
    text = file.read(5)
    print(text)

